<%--
  Created by IntelliJ IDEA.
  User: lt
  Date: 2018/5/22
  Time: 11:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<%@ taglib prefix="jap" uri="http://www.springframework.org/tags/form" %>
<c:set var="contextPath" value="${pageContext.request.contextPath}"></c:set>
<c:set var="id" value="${pageContext.request.getParameter('id')}"></c:set>

<title>供应商 - 商品详细表</title>

<%--<link rel="stylesheet" href="${contextPath}/static/layer/css/layui.css" media="all">--%>
<link rel="stylesheet" href="${contextPath}/static/ace/components/_mod/jquery-ui/jquery-ui.css"/>
<%--<link rel="stylesheet" href="${contextPath}/static/statistics/css/bootstrap-datetimepicker.min.css">--%>
<link rel="stylesheet"
      href="${contextPath}/static/ace/components/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css"/>
<link rel="stylesheet" href="${contextPath}/static/ace/components/_mod/jqgrid/ui.jqgrid.css"/>
<script src="${contextPath}/static/statistics/js/bootstrap-datetimepicker.min.js"></script>
<%--<script src="${contextPath}/static/statistics/js/bootstrap-datetimepicker.fr.js"></script>--%>
<script src="${contextPath}/static/statistics/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${contextPath}/static/statistics/js/vue.js"></script>
<%--<jsp:include page="../../../head.jsp"/>--%>
<style type="text/css">
    .customBtn {
        line-height: 20px;
        margin-bottom: 3px;
    }

    .btnLine {
        margin-left: 1px;
        margin-top: 8px;
        margin-bottom: 2px;
    }

    @-webkit-keyframes bouncedelay {
        0%, 80%, 100% {
            -webkit-transform: scale(0.0)
        }
        40% {
            -webkit-transform: scale(1.0)
        }
    }

    @keyframes bouncedelay {
        0%, 80%, 100% {
            transform: scale(0.0);
            -webkit-transform: scale(0.0);
        }
        40% {
            transform: scale(1.0);
            -webkit-transform: scale(1.0);
        }
    }

    .autocomplete-suggestions {
        border: 1px solid #999;
        background: #FFF;
        overflow: auto;
    }

    .autocomplete-suggestion {
        padding: 2px 5px;
        white-space: nowrap;
        overflow: hidden;
    }

    .autocomplete-selected {
        background: #F0F0F0;
    }

    .autocomplete-suggestions strong {
        font-weight: normal;
        color: #3399FF;
    }

    @-moz-document url-prefix() {
        fieldset {
            display: table-cell;
        }
    }

    .ui-jqgrid-sortable {
        text-align: center;
    }
</style>

<div class="row" id="appAlert">
    <div class="row btnLine">
        <div class="button-len col-sm-12">
            <div style="width: 100%; margin-bottom: 10px;">
                <button class="btn btn-white btn-sm btn-purple customBtn" id="addProduct">
                    <i class="ace-icon fa fa-plus-circle purple"></i> 新增
                </button>

                <%--<button class="btn btn-white btn-info btn-sm customBtn" id="editShop">--%>
                    <%--<i class="ace-icon fa fa-pencil blue"></i> 修改--%>
                <%--</button>--%>
                <button class="btn btn-white btn-info btn-sm customBtn" id="deleteSupplier">
                    <i class="ace-icon fa fa-key red"></i> 删除
                </button>
                <%--<button class="btn btn-white btn-info btn-sm customBtn" id="">--%>
                    <%--<i class="ace-icon fa fa-key red"></i> 复制--%>
                <%--</button>--%>
                <%--<button class="btn btn-white btn-info btn-sm customBtn" id="">--%>
                    <%--<i class="ace-icon fa fa-key red"></i> 打印--%>
                <%--</button>--%>
                <%--<button class="btn btn-white btn-info btn-sm customBtn" id="">--%>
                    <%--<i class="ace-icon fa fa-key red"></i> 导出--%>
                <%--</button>--%>
                <%--<button class="btn btn-white btn-info btn-sm customBtn" id="">--%>
                    <%--<i class="ace-icon fa fa-key red"></i> 设置--%>
                <%--</button>--%>
                <%--<button class="btn btn-white btn-info btn-sm customBtn" id="">--%>
                    <%--<i class="ace-icon fa fa-key red"></i> 退出--%>
                <%--</button>--%>
            <%--</div>--%>
            <%--<div style="width: 100%; margin-bottom: 10px;">--%>
                <input class="input-sm" type="text" id="productType" name="productType" style="margin-left: 0px;"
                       placeholder="类别">
                <input class="input-sm" type="text" id="productCode1" name="productCode1" style="margin-left: 0px;"
                       placeholder="货号">
                <%--<input class="input-sm" type="text"style="margin-left: 0px;"--%>
                       <%--placeholder="品牌">--%>
                <input class="input-sm" type="text" id="helpCode" name="helpCode" style="margin-left: 0px;"
                       placeholder="助记码">
                <input class="input-sm" type="text" id="recordId" name="recordId" style="margin-left: 0px;"
                       placeholder="自编码">
                <button class="btn btn-sm btn-white btn-info search-len customBtn"
                        onclick="searchShop()">
                    <i class="ace-icon fa fa-search orange"></i>搜索
                </button>
                <button type="button" class="btn btn-sm btn-white btn-info search-len customBtn" onclick="javascript:window.history.go(-1);window.close();">返回</button>
            </div>
            <%--<label for="">零售价：</label>--%>
            <%--<select class="input-sm" id="isAuthInput">--%>
                <%--<option value="=">等于</option>--%>
                <%--<option value=">">大于</option>--%>
                <%--<option value=">=">大于等于</option>--%>
                <%--<option value="<">小于</option>--%>
                <%--<option value="<=">小于等于</option>--%>
            <%--</select>--%>
            <%--<input class="input-sm" type="text" id="" style="margin-left: 0px;"--%>
                   <%--placeholder="零售价">--%>

        </div>
    </div>
    <!-- 内容数据开始 -->
    <div class="col-xs-12">
        <table id="grid-table"></table>

        <div id="grid-pager"></div>

    </div>

    <!-- 内容数据结束 -->


    <!-- 商品模态框（Modal） -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width: 840px;">
            <div class="modal-content">
                <div class="modal-header" style="font-size: 20px; margin-bottom: -15px;">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        供应商 - <span id="alertTitle">商品新增</span>
                        <small id="smallTitle" class="hide" style="color: red; float: right; margin-top: 10px;"></small>
                    </h4>
                </div>
                <div class="modal-body">
                    <div class="row" style="height: 100px;">
                        <table class="table">
                            <tbody>
                            <tr>
                                <th>
                                    <div class="row btnLine">
                                        <div class="button-len col-sm-12">
                                            <label for="" style="margin-left: 8px;">商品类型：</label>
                                            <select class="input-sm" id="isExpInput">
                                                <option value="0">商品类型</option>
                                                <option :value="obj.typeId" v-for="(obj, index) in yanType1">
                                                    {{ obj.typeName }}
                                                </option>

                                            </select>
                                            <select class="input-sm" id="isAuthInput">
                                                <option value="-1">商品大类</option>
                                                <option :value="obj.typeId" v-for="(obj, index) in yanType2">
                                                    {{ obj.typeName }}
                                                </option>
                                            </select>

                                            <select class="input-sm" id="isAuthInput1">
                                                <option value="-1">商品中类</option>
                                                <option :value="obj.typeId" v-for="(obj, index) in yanType3">
                                                    {{ obj.typeName }}
                                                </option>
                                            </select>

                                            <select class="input-sm" id="isAuthInput2">
                                                <option value="-1">商品小类</option>
                                                <option :value="obj.typeId" v-for="(obj, index) in yanType4">
                                                    {{ obj.typeName }}
                                                </option>
                                            </select>
                                        </div>
                                    </div>
                                </th>
                            </tr>
                            <tr>
                                <th>
                                    <input class="input-sm" type="text" id="productCode" style="margin-left: 20px;"
                                           placeholder="商品条码">
                                    <input class="input-sm" type="text" id="productName" style="margin-left: 5px;"
                                           placeholder="商品名称">
                                    <button class="btn btn-sm btn-white btn-info search-len customBtn"
                                            onclick="searchShopProduct()">
                                        <i class="ace-icon fa fa-search orange"></i>搜索
                                    </button>
                                </th>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <!-- 内容数据开始 -->
                    <div class="button-len col-sm-12">
                        <table id="grid-prod-table"></table>
                        <div id="grid-prod-pager"></div>
                    </div>
                    <!-- 内容数据结束 -->
                    <div style="text-align: right;">
                        <button class="btn btn-white btn-info btn-sm customBtn btn-xs" type="button" id="appProd" onclick="addSupplierShop()" style="margin-top: 10px; margin-right: 11px;">添加</button>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default btn-xs" data-dismiss="modal" v-on:click="close">关闭</button>
                    <%--<button type="button" class="btn btn-primary btn-xs" v-on:click="saveSupplier">提交更改</button>--%>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>

    <!-- 模态框（Modal） -->
    <%--<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">--%>
        <%--<div class="modal-dialog" style="width: 800px;">--%>
            <%--<div class="modal-content">--%>
                <%--<div class="modal-header" style="font-size: 20px; margin-bottom: -15px;">--%>
                    <%--<h4 class="modal-title" id="myModalLabel">--%>
                        <%--供应商 - <span id="alertTitle">商品新增</span>--%>
                        <%--<small id="smallTitle" class="hide" style="color: red; float: right; margin-top: 10px;"></small>--%>

                    <%--</h4>--%>
                <%--</div>--%>
                <%--<div class="modal-body">--%>
                    <%--<div class="row">--%>
                        <%--<table class="table">--%>
                            <%--<tbody>--%>
                                <%--<tr>--%>
                                    <%--<th>--%>
                                        <%--<div class="row btnLine">--%>
                                            <%--<div class="button-len col-sm-12">--%>
                                                <%--<label for="" style="margin-left: 8px;">商品类型：</label>--%>
                                                <%--<select class="input-sm" id="isExpInput">--%>
                                                    <%--<option value="0">商品类型</option>--%>
                                                    <%--<option :value="obj.typeId" v-for="(obj, index) in yanType1">--%>
                                                        <%--{{ obj.typeName }}--%>
                                                    <%--</option>--%>

                                                <%--</select>--%>
                                                <%--<select class="input-sm" id="isAuthInput">--%>
                                                    <%--<option value="-1">商品大类</option>--%>
                                                    <%--<option :value="obj.typeId" v-for="(obj, index) in yanType2">--%>
                                                        <%--{{ obj.typeName }}--%>
                                                    <%--</option>--%>
                                                <%--</select>--%>

                                                <%--<select class="input-sm" id="isAuthInput1">--%>
                                                    <%--<option value="-1">商品中类</option>--%>
                                                    <%--<option :value="obj.typeId" v-for="(obj, index) in yanType3">--%>
                                                        <%--{{ obj.typeName }}--%>
                                                    <%--</option>--%>
                                                <%--</select>--%>

                                                <%--<select class="input-sm" id="isAuthInput2">--%>
                                                    <%--<option value="-1">商品小类</option>--%>
                                                    <%--<option :value="obj.typeId" v-for="(obj, index) in yanType4">--%>
                                                        <%--{{ obj.typeName }}--%>
                                                    <%--</option>--%>
                                                <%--</select>--%>
                                            <%--</div>--%>
                                        <%--</div>--%>
                                    <%--</th>--%>
                                <%--</tr>--%>
                                <%--<tr>--%>
                                    <%--<th>--%>
                                        <%--<input class="input-sm" type="text" id="productCode" style="margin-left: 20px;"--%>
                                               <%--placeholder="商品条码">--%>
                                        <%--<input class="input-sm" type="text" id="productName" style="margin-left: 5px;"--%>
                                               <%--placeholder="商品名称">--%>
                                        <%--<button class="btn btn-sm btn-white btn-info search-len customBtn"--%>
                                                <%--v-on:click="queryShop">--%>
                                            <%--<i class="ace-icon fa fa-search orange"></i>搜索--%>
                                        <%--</button>--%>
                                    <%--</th>--%>
                                <%--</tr>--%>
                                <%--<tr>--%>
                                    <%--<th>--%>
                                        <%--<!-- 商品数据开始 -->--%>
                                        <%--<table class="table table-striped table-condensed table-bordered" style="background-color: #eee; width: 100%; font-size: 10px;">--%>
                                            <%--<thead>--%>
                                            <%--<tr>--%>
                                                <%--<th>ID</th>--%>
                                                <%--<th>商品名称</th>--%>
                                                <%--<th>类型</th>--%>
                                                <%--<th>条码</th>--%>
                                                <%--<th>供货价格</th>--%>
                                                <%--<th>商品价格</th>--%>
                                                <%--<th>状态</th>--%>
                                                <%--<th>单位</th>--%>
                                                <%--<th>规格</th>--%>
                                                <%--<th>操作</th>--%>
                                            <%--</tr>--%>
                                            <%--</thead>--%>
                                            <%--<tbody>--%>
                                            <%--<tr v-for="(obj, index) in objects">--%>
                                                <%--<th>{{ obj.id }}</th>--%>
                                                <%--<td>{{ obj.productName }}</td>--%>
                                                <%--<th>{{ obj.prodTypeName }}</th>--%>
                                                <%--<th>--%>
                                                    <%--{{ obj.productCode }}--%>
                                                    <%--<input type="text" name="productCode" :value="obj.productCode" style="display:none"/>--%>
                                                    <%--<input type="text" name="cstPrice" :value="obj.cstPrice" style="display:none"/>--%>
                                                <%--</th>--%>
                                                <%--<th>--%>
                                                    <%--<input class="input-sm" type="text" style="margin-left: 20px;"--%>
                                                           <%--placeholder="">--%>
                                                    <%--<input type="text" name="supplierPrice" :value="obj.supplierPrice" style="border:0;outline:0; width: 30px; background-color: #F5F8FC;margin: 0px auto;"/>--%>
                                                <%--</th>--%>
                                                <%--<th>{{ obj.cstPrice }}</th>--%>
                                                <%--<th>{{ obj.state }}</th>--%>
                                                <%--<th>{{ obj.unit }}</th>--%>
                                                <%--<th>{{ obj.spec }}</th>--%>
                                                <%--<th>--%>
                                                    <%--<button onclick="addSupplierShop()">添加</button>--%>
                                                <%--</th>--%>
                                            <%--</tr>--%>
                                            <%--</tbody>--%>
                                        <%--</table>--%>
                                        <%--<!-- 商品数据结束 -->--%>
                                    <%--</th>--%>
                                <%--</tr>--%>
                            <%--</tbody>--%>
                        <%--</table>--%>
                    <%--</div>--%>
                    <%--<!-- 内容数据开始 -->--%>
                    <%--<div class="col-xs-12">--%>
                        <%--<table id="grid-product-table"></table>--%>

                        <%--<div id="grid-product-pager"></div>--%>

                    <%--</div>--%>

                    <%--<!-- 内容数据结束 -->--%>
                <%--</div>--%>
                <%--<div class="modal-footer">--%>
                    <%--<button type="button" class="btn btn-default btn-xs" data-dismiss="modal" v-on:click="close">关闭</button>--%>
                    <%--&lt;%&ndash;<button type="button" class="btn btn-primary btn-xs" v-on:click="saveSupplier">提交更改</button>&ndash;%&gt;--%>
                <%--</div>--%>
            <%--</div><!-- /.modal-content -->--%>
        <%--</div><!-- /.modal -->--%>
    <%--</div>--%>
</div>

<!-- page specific plugin scripts -->
<script type="text/javascript" src="${contextPath}/static/statistics/js/jquery.mockjax.js"></script>
<script type="text/javascript" src="${contextPath}/static/statistics/js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="${contextPath}/static/ace/components/bootstrap-datepicker/dist/js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="${contextPath}/static/ace/components/jqGrid/js/jquery.jqGrid.js"></script>
<script type="text/javascript" src="${contextPath}/static/ace/components/jqGrid/js/i18n/grid.locale-cn.js"></script>
<script type="text/javascript" src="${contextPath}/static/layer/layer.js"></script>
<script type="text/javascript">

    var grid_selector = "#grid-table";
    var pager_selector = "#grid-pager";

    var grid_prod_selector = "#grid-prod-table";
    var pager_prod_selector = "#grid-prod-pager";

    var grid_selector_shop = "#grid-table-shop";
    var pager_selector_shop = "#grid-pager-shop";

    var filters = {
        "rules": [{
            "field": "supplierId",
            "data": '${id}'
        }]
    };
    var grid_data = {'filters': JSON.stringify(filters)};
    var scripts = [null, "${contextPath}/static/ace/components/bootstrap-datepicker/dist/js/bootstrap-datepicker.js", "${contextPath}/static/ace/components/jqGrid/js/jquery.jqGrid.js", "${contextPath}/static/ace/components/jqGrid/js/i18n/grid.locale-cn.js", "${contextPath}/static/layer/layer.js", null]

    $('.page-content-area').ace_ajax('loadScripts', scripts, function () {
        jQuery(function ($) {
            var parent_column = $(grid_selector).closest('[class*="col-"]');
            //resize to fit page size
            $(window).on('resize.jqGrid', function () {
                $(grid_selector).jqGrid('setGridWidth', parent_column.width());
            })

            //resize on sidebar collapse/expand
            $(document).on('settings.ace.jqGrid', function (ev, event_name, collapsed) {
                if (event_name === 'sidebar_collapsed' || event_name === 'main_container_fixed') {
                    //setTimeout is for webkit only to give time for DOM changes and then redraw!!!
                    setTimeout(function () {
                        $(grid_selector).jqGrid('setGridWidth', parent_column.width());
                    }, 20);
                }
            })

            jQuery(grid_selector).jqGrid({
                //direction: "rtl",

                //subgrid options
                subGrid: false,
                url: "${contextPath}/ktProd/getSupplierProdList",
                postData: grid_data,
                datatype: "json",
                mtype: 'POST',
                height: 300,
                colNames: [
                    '自编码','货号','品名','单位','规格',
// '进货规格6','计价方式7','提成率8','提成金额9',
                    '进货价',
                    '商品价格',
// '最低限价12','零售价13','批发价14','主供应商15','毛利率16',
                    '助记码',
//                    '库管类型18',
                    '商品简称',
                    '类别','类别名称',
//                    '品牌22','品牌名称23','产地24',
                    '供应商编号',
//                    '经营方式26',
                    '供应商名称',
//                    '商品属性28','商品类型29','进项税30','销项税31','是否积分32','积分值33','维护库存34','前台赠送35','前台议价36','前台打折37','分店变价38',
                    '建档人','建档时间','最后修改人','最后修改时间'
//                    ,'英文名称43'
                ],

                //PageDTO [currentPage=1, pageSize=10, recordList=[{spec=20支, cstPrice=9.1, createTime=2018-05-18 21:13:03, supplierName=默认供应商,
                // rn=1, imageUrl=null, state=1, brandId=PP, brandName=其他品牌,
                // productType=1, id=1, stockSpec=1, productTypeName=普通商品, bonusPointsFlag=1,
                // modifyTime=null, supplierId=1, productCode=6901028000826, shopModifyFlag=1,
                // rtlPrice=10, supplierPrice=1, unit=包, createUser=null, modifyUser=null,
                // selfCode=02020034, deliverPrice=0, vipPrice=9, helpCode=JDCXSXYB,
                // shortName=经典醇香双喜烟包, productName=经典醇香双喜烟包, typeId=3401, dispatchPrice=7, minPrice=0}], recordCount=1, pageCount=1, beginPageIndex=1, endPageIndex=1]
                colModel: [
                    {name: 'selfCode',index: 'selfCode',editable: true},
                    {name: 'productCode',index: 'productCode',editable: true},
                    {name: 'brandName',index: 'brandName',editable: true},
                    {name: 'unit',index: 'unit',editable: true},
                    {name: 'spec',index: 'spec',editable: true},
//                    {name: '6',index: '6',editable: true},
//                    {name: '7',index: '7',editable: true},
//                    {name: '8',index: '8',editable: true},
//                    {name: '9',index: '9',editable: true},
                    {name: 'supplierPrice',index: 'supplierPrice',editable: true},
                    {name: 'cstPrice',index: 'cstPrice',editable: true},
//                    {name: '12',index: 'id',editable: true},
//                    {name: '13',index: 'id',editable: true},
//                    {name: '14',index: 'id',editable: true},
//                    {name: '15',index: 'id',editable: true},
//                    {name: '16',index: 'id',editable: true},
                    {name: 'helpCode',index: 'helpCode',editable: true},
//                    {name: '18',index: 'id',editable: true},
                    {name: 'shortName',index: 'shortName',editable: true},
                    {name: 'productType',index: 'productType',editable: true},
                    {name: 'productTypeName',index: 'productTypeName',editable: true},
//                    {name: '22',index: 'id',editable: true},
//                    {name: '23',index: 'id',editable: true},
//                    {name: '24',index: 'id',editable: true},
                    {name: 'supplierId',index: 'supplierId',editable: true},
//                    {name: '26',index: 'id',editable: true},
                    {name: 'supplierName',index: 'supplierName',editable: true},
//                    {name: '28',index: 'id',editable: true},
//                    {name: '29',index: 'id',editable: true},
//                    {name: '30',index: 'id',editable: true},
//                    {name: '31',index: 'id',editable: true},
//                    {name: '32',index: 'id',editable: true},
//                    {name: '33',index: 'id',editable: true},
//                    {name: '34',index: 'id',editable: true},
//                    {name: '35',index: 'id',editable: true},
//                    {name: '36',index: 'id',editable: true},
//                    {name: '37',index: 'id',editable: true},
//                    {name: '38',index: 'id',editable: true},
                    {name: 'createUser',index: 'createUser',editable: true},
                    {name: 'createTime',index: 'createTime',editable: true},
                    {name: 'modiftUser',index: 'modiftUser',editable: true},
                    {name: 'modiftTime',index: 'modiftTime',editable: true},

//                    {name: '43',index: 'id',editable: true},
                ],
                rownumbers: true, //自动行数
//                        width:"1000",
                autowidth:true,  //宽度自适应
//                        height:"100%",   //高度自适应
                viewrecords: true,
                rowNum : 10,//一页显示多少条
                rowList : [ 10, 20, 30 ],//可供用户选择一页显示多少条
                pager : pager_selector,//表格页脚的占位符(一般是div)的id
                sortname : 'gmtModifiedStr',//初始化的时候排序的字段
                sortorder : "desc",//排序方式,可选desc,asc
//                mtype : "post",//向后台请求数据的ajax的类型。可选post,get
                altRows: true,
//                toppager: true,
                multiselect: false,
                //multikey: "ctrlKey",
                multiboxonly: true,

                loadComplete: function () {
                    var table = this;
                    setTimeout(function () {
                        styleCheckbox(table);

                        updateActionIcons(table);
                        updatePagerIcons(table);
                        enableTooltips(table);
                    }, 0);
                },

                editurl: "${contextPath}/ktPurchase/saveSupplier",//nothing is saved
                caption: "商品详细表",
                jsonReader: {
                    root: "recordList",
                    page: "currentPage",
                    total: "pageCount",
                    records: "recordCount"
                }

                //,autowidth: true,


                /**
                 ,
                 grouping:true,
                 groupingView : {
				 groupField : ['name'],
				 groupDataSorted : true,
				 plusicon : 'fa fa-chevron-down bigger-110',
				 minusicon : 'fa fa-chevron-up bigger-110'
			},
                 caption: "Grouping"
                 */

            });

            $(window).triggerHandler('resize.jqGrid');//trigger window resize to make the grid get the correct size


            <%--function cLink(cellvalue, options, rowObject){--%>
                <%--console.log(rowObject)--%>
                <%--var id = rowObject.id;--%>
                <%--return '<a href="${contextPath}/sys/user/home#page/prodInfo" onclick="">'+id+'</a>';--%>
            <%--}--%>


            /**
             * 修改某条信息
             */
            $("#editShop").click(function () {
                var id = $(grid_selector).jqGrid('getGridParam', 'selrow');
                if (!id) {
                    $.jgrid.info_dialog("提示：", "请选择一条信息");
                    return;
                }

                var rowData = $(grid_selector).jqGrid('getRowData', id);
//                console.log(rowData);
//                layer.load(1);
                getSupplier(rowData);
                reload();

            });

            /**
             * 删除某条数据
             */
            $("#deleteSupplier").click(function () {
                var id = $(grid_selector).jqGrid('getGridParam', 'selrow');
                if (!id) {
                    layer.msg("提示：请选择一条信息");
                    return;
                }
//询问框
                layer.confirm('将会把这条商品数据删除', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    var rowData = $(grid_selector).jqGrid('getRowData', id);
                    queryModel.id = rowData.recordId;
                    queryModel.state = '0';
                    layer.load(1);
                    $.ajax({
                        url: '${contextPath}/ktProd/saveSupplierProd',
                        type: 'post',
                        data: queryModel,
                        dataType: 'json',
                        success: function (data) {
                            layer.closeAll('loading');
                            if (data.success) {
                                layer.msg('删除成功', {icon: 1});

                            } else {
                                layer.msg(data.message);
                            }
                            reload();

                        },
                        error: function (error) {
                            layer.closeAll('loading');
                            $.jgrid.info_dialog("提示：", "服务器异常，稍后再试");
                        }

                    })

                }, function () {
                });
            });
        });
    });
</script>
<script type="text/javascript">

    /**
     * 搜索店铺
     */
    function search_Shop() {
        var typeId = queryModel.parentId;
        var productCode = $("#productCode").val();
        var productName = $("#productName").val();
        //var parentDepartmentkey = $("#id_parentDepartmentkey_name").val();

        var filters = {
            "rules": [
                {"field": "productCode", "data": productCode},
                {"field": "productName", "data": productName},
                {"field": "typeId", "data": typeId}
            ]
        };
        jQuery("#grid-table-shop").jqGrid('setGridParam', {
            postData: {
                "filters": JSON.stringify(filters) //"{'rules' : [{'field' : 'shopName','data' : "+shopName+"},{'field' : 'state','data' : "+state+"}]}"
            }
        }).trigger("reloadGrid");
    }

    /**
     * 搜索店铺
     */
    function searchShop() {
        var keyword = $("#keyword").val();
//        var phone = $("#phone").val();
        //var parentDepartmentkey = $("#id_parentDepartmentkey_name").val();

        var filters = {
            "rules": [{
                "field": "supplierId",
                "data": '${id}'
            }]
        };
        jQuery("#grid-table").jqGrid('setGridParam', {
            postData: {
                "filters": JSON.stringify(filters) //"{'rules' : [{'field' : 'shopName','data' : "+shopName+"},{'field' : 'state','data' : "+state+"}]}"
            }
        }).trigger("reloadGrid");
    }

    $("#id").show();
    var img64 = "";
    $("#showImageInfoImg").attr("src", img64);
    $("#showImageInfoImg1").attr("src", img64);

    var laypage = layui.laypage,
        layer = layui.layer
    laydate = layui.laydate;

    var queryModel = {
        //分页参数
        page: '1',
        rows: '10',
        //图片参数
//        fileStr: '',
//        fileType: '',
//        fileStart: '',
//        supplierName: '',
//        state: '',
//        createTime: '',
//        createUser: '',
//        modifyTime: '',
//        modifyUser: '',
//        contactName: '',
//        mobile: '',
//        helpCode: '',
//        phone: '',
//        fax: '',
//        email: '',
//        zipCode: '',
//        operatorWay: '',
//        salesMan: '',
//        zoneCode: '',
//        settlementWay: '',
//        freezeAccounts: '',
//        freezeBusiness: '',
//        deliverCycle: '',
//        settlementCycle: '30',
//        monthSettlementDay: '30',
//        remark: '',
//        registerWay: '',
//        orgCode: '',
//        bankOfDeposit: '',
//        account: '',
//        businessLicenseNo: '',
//        taxRegistrationNo: '',
//        userName: '',
//        businessLicenseImage: '',
//        licenseImage: '',
//        defaultPurchaseWay: '',
//        guaranteeQuota: '',
//        discountRate: ''
    }

    var app = new Vue({
        el: '#appAlert',
        data: {
            objects: [],
            yanType1: [],
            yanType2: [],
            yanType3: [],
            yanType4: []
        },
        methods: {
            tableShow: function () {
                $("#alertTitle").html("新增")
                $("#businessLicenseDiv").addClass("hide")
                $("#licenceDiv").addClass("hide")
                $("#tableDiv").removeClass("hide")
            },
            businessLicenseShow: function () {
                $("#alertTitle").html("营业执照")
                $("#tableDiv").addClass("hide")
                $("#licenceDiv").addClass("hide")
                $("#businessLicenseDiv").removeClass("hide")
            },
            licenceShow: function () {
                $("#alertTitle").html("许可证")
                $("#tableDiv").addClass("hide")
                $("#businessLicenseDiv").addClass("hide")
                $("#licenceDiv").removeClass("hide")
            },
            saveSupplier: function () {
                $("#smallTitle").addClass("hide")
                $("#showImageInfoImg").attr("src",img64)
                $("#showImageInfoImg1").attr("src",img64)
                queryObjects()
            },
            addShop: function () {
                var rowData = {}
                editShop(rowData)
            },
            submitImg: function () {
//                submitImg("1")
            },
            submitImg1: function () {
//                submitImg("2")
            },
            close: function () {
                $("#alertTitle").html("新增")
                $("#businessLicenseDiv").addClass("hide")
                $("#licenceDiv").addClass("hide")
                $("#tableDiv").removeClass("hide")
                $("#smallTitle").addClass("hide")
                $("#showImageInfoImg").attr("src",img64)
                $("#showImageInfoImg1").attr("src",img64)
            },
            queryShop: function () {
                queryObjectsShop()
            }
        }
    });

    var getSupplier = function (rowData) {
        queryModel.id = rowData.id;
        layer.load(1)
        $.ajax({
            url: '${contextPath}/ktPurchase/getSupplier',
            type: 'post',
            data: queryModel,
            success: function (data) {
                layer.closeAll('loading');
                if (data.success == false){
                    layer.msg("获取出错："+data.message)
                    return
                }
                var dataArray = data.data;
                if (dataArray.length == 0){
                    layer.msg("查询没有数据")
                    return
                }
                console.log(dataArray)
                editShop(dataArray);
            },
            error: function (error) {
                layer.closeAll('loading')
            }
        })
    };

    var queryModel_map = {
        //分页参数
        page: '1',
        rows: '10',

        parentId: '0'  //商品4级下拉菜单
    }

    var getObjectsShop = function (queryModel_map) {
        layer.load(1)
        $.ajax({
            url: '${contextPath}/ktProd/getProdInfo',
            type: 'post',
            data: queryModel_map,
            success: function (data) {
                layer.closeAll('loading');
                if (data.success == false){
                    layer.msg("获取出错："+data.message)
                    return
                }
                var dataArray = data.recordList;
                if (dataArray.length == 0){
                    layer.msg("查询没有数据")
                    return
                }
                 app.objects = dataArray;
            },
            error: function (error) {
                layer.closeAll('loading')
            }
        })
    };

    var queryObjectsShop = function () {
        var typeId = queryModel_map.parentId;
        var productCode = $("#productCode").val();
        var productName = $("#productName").val();

        if (typeId == "0"){
            typeId = "";
        }
        console.log(typeId);
        var filters = {
            "rules": [
                {"field": "productCode", "data": productCode},
                {"field": "productName", "data": productName},
                {"field": "typeId", "data": typeId}
            ]
        };
        queryModel_map.filters = JSON.stringify(filters);
        console.log(queryModel_map);
        getObjectsShop(queryModel_map)
    }
    queryObjectsShop()

    $('#beginTime').datetimepicker({
        language: 'zh-CN',
        weekStart: 1,
        todayBtn: 1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        minView: 2,
        showMeridian: 1,
        format: "yyyy-mm-dd",
//        startDate:new Date(),
    });

    $('#endTime').datetimepicker({
        language: 'zh-CN',
        weekStart: 1,
        todayBtn: 1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        minView: 2,
        showMeridian: 1,
        format: "yyyy-mm-dd",
//        startDate:new Date(),
    });

    /**
     * 弹窗内容
     * @param rowData
     */
    var editShop = function (rowData) {
        $("#id").val(rowData.id);
        $("#supplierName").val(rowData.supplierName);
        $("#state").val(rowData.state);
        $("#createTime").val(rowData.createTime);
        $("#createUser").val(rowData.createUser);
        $("#modifyTime").val(rowData.modifyTime);
        $("#modifyUser").val(rowData.modifyUser);
        $("#contactName").val(rowData.contactName);
        $("#mobile").val(rowData.mobile);
        $("#helpCode").val(rowData.helpCode);
        $("#phone").val(rowData.phone);
        $("#fax").val(rowData.fax);
        $("#email").val(rowData.email);
        $("#zipCode").val(rowData.zipCode);
        $("#operatorWay").val(rowData.operatorWay);
        $("#salesMan").val(rowData.salesMan);
        $("#zoneCode").val(rowData.zoneCode);
        $("#settlementWay").val(rowData.settlementWay);
        $("#freezeAccounts").val(rowData.freezeAccounts);
        $("#freezeBusiness").val(rowData.freezeBusiness);
        $("#deliverCycle").val(rowData.deliverCycle);
//        $("#settlementCycle").val(rowData.settlementCycle);
//        $("#monthSettlementDay").val(rowData.monthSettlementDay);
        $("#remark").val(rowData.remark);
        $("#registerWay").val(rowData.registerWay);
        $("#orgCode").val(rowData.orgCode);
        $("#bankOfDeposit").val(rowData.bankOfDeposit);
        $("#account").val(rowData.account);
        $("#businessLicenseNo").val(rowData.businessLicenseNo);
        $("#taxRegistrationNo").val(rowData.taxRegistrationNo);
        $("#userName").val(rowData.userName);
//        $("#businessLicenseImage").val(rowData.businessLicenseImage);
//        $("#licenseImage").val(rowData.licenseImage);
        $("#defaultPurchaseWay").val(rowData.defaultPurchaseWay);
        $("#guaranteeQuota").val(rowData.guaranteeQuota);
        $("#discountRate").val(rowData.discountRate);

        var businessLicenseImage = !rowData.businessLicenseImage;
        var licenseImage = !rowData.licenseImage;
        console.log(!licenseImage)
        if (!businessLicenseImage) {
            $("#showImageInfoImg").attr("src", 'http://clouderp.skystorechain.com:20081/'+rowData.businessLicenseImage);
        }
        if (!licenseImage) {
            $("#showImageInfoImg1").attr("src", 'http://clouderp.skystorechain.com:20081/'+rowData.licenseImage);
        }
        $('#myModal').modal('show');
    }


    var reload = function () {
//        $(grid_selector).jqGrid('clearGridData');  //清空表格
        $(grid_selector).jqGrid('setGridParam',{
            url:"${contextPath}/ktProd/getSupplierProdList",
            datatype:'json',
            postData: grid_data,
            page:1
        }).trigger("reloadGrid"); //重新载入
    }

</script>
<script type="application/javascript">
    //it causes some flicker when reloading or navigating grid
    //it may be possible to have some custom formatter to do this as the grid is being created to prevent this
    //or go back to default browser checkbox styles for the grid
    function styleCheckbox(table) {
        /**
         $(table).find('input:checkbox').addClass('ace')
         .wrap('<label />')
         .after('<span class="lbl align-top" />')


         $('.ui-jqgrid-labels th[id*="_cb"]:first-child')
         .find('input.cbox[type=checkbox]').addClass('ace')
         .wrap('<label />').after('<span class="lbl align-top" />');
         */
    }


    //unlike navButtons icons, action icons in rows seem to be hard-coded
    //you can change them like this in here if you want
    function updateActionIcons(table) {
        /**
         var replacement =
         {
             'ui-ace-icon fa fa-pencil' : 'ace-icon fa fa-pencil blue',
             'ui-ace-icon fa fa-trash-o' : 'ace-icon fa fa-trash-o red',
             'ui-icon-disk' : 'ace-icon fa fa-check green',
             'ui-icon-cancel' : 'ace-icon fa fa-times red'
         };
         $(table).find('.ui-pg-div span.ui-icon').each(function(){
				var icon = $(this);
				var $class = $.trim(icon.attr('class').replace('ui-icon', ''));
				if($class in replacement) icon.attr('class', 'ui-icon '+replacement[$class]);
			})
         */
    }

    //replace icons with FontAwesome icons like above
    function updatePagerIcons(table) {
        var replacement =
            {
                'ui-icon-seek-first': 'ace-icon fa fa-angle-double-left bigger-140',
                'ui-icon-seek-prev': 'ace-icon fa fa-angle-left bigger-140',
                'ui-icon-seek-next': 'ace-icon fa fa-angle-right bigger-140',
                'ui-icon-seek-end': 'ace-icon fa fa-angle-double-right bigger-140'
            };
        $('.ui-pg-table:not(.navtable) > tbody > tr > .ui-pg-button > .ui-icon').each(function () {
            var icon = $(this);
            var $class = $.trim(icon.attr('class').replace('ui-icon', ''));

            if ($class in replacement) icon.attr('class', 'ui-icon ' + replacement[$class]);
        })
    }

    function enableTooltips(table) {
        $('.navtable .ui-pg-button').tooltip({container: 'body'});
        $(table).find('.ui-pg-div').tooltip({container: 'body'});
    }
</script>

<script type="text/javascript">
    var addSupplier = function () {
        console.log(queryModel_map);
        layer.load(1)
        $.ajax({
            url: '${contextPath}/ktProd/saveSupplierProd',
            type: 'post',
            data: queryModel_map,
            success: function (data) {
                layer.closeAll('loading');
                if (data.success == false){
                    layer.msg("提示："+data.message)
                    return
                }
                if (data.success){
                    layer.msg("提示："+data.message)
                }
                reload()
            },
            error: function (error) {
                layer.closeAll('loading')
            }
        })
    }

//    $("#supplierPrice").blur(function () {
//        var supplierPrice = this.value;
//        alert(supplierPrice);
//        layer.msg("提示：")
//        $("#supplierPrice").val("");
//    })

    var addSupplierShop = function () {
        var ids = $(grid_prod_selector).jqGrid('getGridParam', 'selarrrow');
        if(!ids){
            layer.msg("提示：请选择商品")
            return
        }

        for(var i = 0; i < ids.length; i++){

            var rowData = $(grid_prod_selector).jqGrid('getRowData', ids[i]);
            var cstPrice_Id = "#cstPrice_" + rowData.productCode;;
            var supplierPrice = $(cstPrice_Id).val();
            if (supplierPrice == ""){
                layer.msg("提示：供货价不能为空！")
                return
            }


            var productCode = rowData.productCode;
            var cstPrice = rowData.cstPrice

            <%--var filters = {--%>
            <%--"rules": [--%>
            <%--{"field": "productCode", "data": productCode},--%>
            <%--{"field": "cstPrice", "data": cstPrice},--%>
            <%--{"field": "state", "data": '1'},--%>
            <%--{"field": "supplierId", "data": '${id}'}--%>
            <%--]--%>
            <%--};--%>
            queryModel_map.productCode = rowData.productCode;;
            queryModel_map.cstPrice = $(cstPrice_Id).val();
            queryModel_map.state = '1';
            queryModel_map.supplierId = '${id}';
//        queryModel_map.filters = JSON.stringify(filters);
            addSupplier(queryModel_map)

        }

        <%--var supplierPrice = $("#supplierPrice").val();--%>
        <%--if (supplierPrice == ""){--%>
            <%--layer.msg("提示：供货价不能为空！")--%>
            <%--return--%>
        <%--}--%>
        <%--if (realminVerify()){--%>
            <%--layer.msg("提示：只能输入正浮点数！")--%>
            <%--return--%>
        <%--}--%>
        <%--var productCode = $("input[name='productCode']").val();--%>
        <%--var cstPrice = $("input[name='cstPrice']").val();--%>

        <%--&lt;%&ndash;var filters = {&ndash;%&gt;--%>
            <%--&lt;%&ndash;"rules": [&ndash;%&gt;--%>
                <%--&lt;%&ndash;{"field": "productCode", "data": productCode},&ndash;%&gt;--%>
                <%--&lt;%&ndash;{"field": "cstPrice", "data": cstPrice},&ndash;%&gt;--%>
                <%--&lt;%&ndash;{"field": "state", "data": '1'},&ndash;%&gt;--%>
                <%--&lt;%&ndash;{"field": "supplierId", "data": '${id}'}&ndash;%&gt;--%>
            <%--&lt;%&ndash;]&ndash;%&gt;--%>
        <%--&lt;%&ndash;};&ndash;%&gt;--%>
        <%--queryModel_map.productCode = productCode;--%>
        <%--queryModel_map.cstPrice = cstPrice;--%>
        <%--queryModel_map.state = '1';--%>
        <%--queryModel_map.supplierId = '${id}';--%>
<%--//        queryModel_map.filters = JSON.stringify(filters);--%>
        <%--addSupplier(queryModel_map)--%>
    }

    /**
     * 下啦联动数据绑定 开始代码
     * @type {{parentId: string}}
     */
    $('#isExpInput').change(function () {
        app.yanType2 = []
        app.yanType3 = []
        app.yanType4 = []
        queryModel_map.parentId = $("#isExpInput option:selected").val();

        console.log(queryModel_map)
        querySubProdType2()
    });

    $('#isAuthInput').change(function () {
        app.yanType3 = []
        app.yanType4 = []
        queryModel_map.parentId = $("#isAuthInput option:selected").val();
        querySubProdType3()
    });

    $('#isAuthInput1').change(function () {
        app.yanType4 = []
        queryModel_map.parentId = $("#isAuthInput1 option:selected").val();
        querySubProdType4()
    });

    var querySubProdType1 = function () {
        getSubProdType1(queryModel_map)
    }
    var querySubProdType2 = function () {
        getSubProdType2(queryModel_map)
    }
    var querySubProdType3 = function () {
        getSubProdType3(queryModel_map)
    }
    var querySubProdType4 = function () {
        getSubProdType4(queryModel_map)
    }


    var getSubProdType1 = function (queryModel_map) {
        $.ajax({
            url: '${contextPath}/ktProd/getSubProdType',
            type: 'post',
            data: queryModel_map,
            success: function (data) {
                if (data.success == false){
                    layer.msg("获取出错："+data.message)
                    return
                }
                var dataArray = data;
                if (dataArray.length == 0){
                    layer.msg("查询没有数据")
                    return
                }
                app.yanType1 = dataArray;

            },
            error: function (error) {
            }
        })
    }

    var getSubProdType2 = function (queryModel_map) {
        console.log(queryModel_map)
        $.ajax({
            url: '${contextPath}/ktProd/getSubProdType',
            type: 'post',
            data: queryModel_map,
            success: function (data) {
                if (data.success == false){
                    layer.msg("获取出错："+data.message)
                    return
                }
                var dataArray = data;
                if (dataArray.length == 0){
                    layer.msg("查询没有数据")
                    return
                }
                console.log("dataArray: "+dataArray)
                app.yanType2 = dataArray;
            },
            error: function (error) {
            }
        })
    }

    var getSubProdType3 = function (queryModel_map) {
        console.log(queryModel_map)
        $.ajax({
            url: '${contextPath}/ktProd/getSubProdType',
            type: 'post',
            data: queryModel_map,
            success: function (data) {
                if (data.success == false){
                    layer.msg("获取出错："+data.message)
                    return
                }
                var dataArray = data;
                if (dataArray.length == 0){
                    layer.msg("查询没有数据")
                    return
                }
                app.yanType3 = dataArray;

            },
            error: function (error) {
            }
        })
    }

    var getSubProdType4 = function (queryModel_map) {
        $.ajax({
            url: '${contextPath}/ktProd/getSubProdType',
            type: 'post',
            data: queryModel_map,
            success: function (data) {
                if (data.success == false){
                    layer.msg("获取出错："+data.message)
                    return
                }
                var dataArray = data;
                if (dataArray.length == 0){
                    layer.msg("查询没有数据")
                    return
                }
                app.yanType4 = dataArray;

            },
            error: function (error) {
            }
        })
    }
    getSubProdType1(queryModel_map);
    /**
     * 下啦联动数据绑定 结束代码
     */
</script>
<script>

    $(document).ready(function() {



//        $("#supplierPrice").blur(function () {
//            alert(1234567890)
////            var supplierPrice = $("#supplierPrice").val();
////            alert(supplierPrice);
////            layer.msg("提示：")
////            $("#supplierPrice").val("");
//        })

        //正浮点数
        var realmin = function (str) {
            var pattern = /[1-9]\d*.\d*|0.\d*[1-9]\d*/;
            console.log(pattern.test(str));
            return pattern.test(str);
        }
    });

</script>
<!-- 商品列表详情 -->
<script>

    $("#addProduct").click(function () {
        prodInfo1('${contextPath}', grid_prod_selector, pager_prod_selector);
        $('#myModal').modal('show');
    })

    /**
     * jqGrid 商品数据列表加载方法
     */
    var prodInfo1 = function(contextPath ,grid_prod_selector, pager_prod_selector) {
        jQuery(grid_prod_selector).jqGrid({
            subGrid: false,
            url : contextPath+'/ktProd/getProdInfo',
            datatype: "json",
            mtype: 'POST',
            height: 300,
            colNames: ['ID', '商品名称', 'supplierId', '供应名称', '类型', '条码','单价','状态','单位','规格', '操作时间'],
            colModel: [
                {name: 'id', index: 'id', editable: true, hidden: true,},
                {
                    name: 'productName',
                    index: 'productName',
//                    width: 90,
                    editable: true,
                    sortable: false,
                    editrules: {required: true}
                },
                {name: 'supplierId', index: 'productId', editable: true, hidden: true,},
                {
                    name: 'supplierName', index: 'productId',
//                    width: 78,
                    editable: true,
                    edittype: 'select', hidden: true,
                },
                {
                    name: 'prodTypeName',
                    index: 'prodTypeName',
//                    width: 60,
                    editable: true,
                    sortable: false,
                    editrules: {required: true}
                },
                {
                    name: 'productCode',
                    index: 'productCode',
//                    width: 60,
                    editable: true,
                    sortable: false,
                    editrules: {required: true}
                },
                {
                    name: 'cstPrice',
                    index: 'cstPrice',
//                    width: 60,
                    editable: true,
                    sortable: false,
//                    hidden: true,
                    editrules: {required: true},
                    formatter:function(cellvalue, options, rowObject) {
                        var productCode = rowObject.productCode;
                        var cstPrice = rowObject.cstPrice;
                        if(!cstPrice){
                            cstPrice = "0"
                        }
                        return ' <input type="text" id="cstPrice_'+productCode+'" value="'+cstPrice+'" style="background-color: #ffffff;border:0;outline:0; margin-top: -16px;float: right; text-align: right;" />';
                    }
                },
                {
                    name: 'state',
                    index: 'state',
//                    width: 40,
                    editable: true,
                    hidden: true,
                    sortable: false,
                    edittype: 'select',
                    formatter: function (v, x, r) {
                        return r['state'] == "1" ? "有效" : "无效";
                    },
                    editoptions: {value: "0:有效;1:无效"}

                },
                {
                    name: 'unit',
                    index: 'unit',
//                    width: 30,
                    editable: true,
                    sortable: false
                },{
                    name: 'spec',
                    index: 'spec',
//                    width: 60,
                    editable: true,
                    hidden: true,
                    sortable: false
                },
                {
                    name: 'stateDate', index: 'stateDate',
//                    width: 60,
                    editable: false, hidden: true,
                }

            ],
//                rownumbers: true, //自动行数
            height:"100%",   //高度自适应
//			width: "100%",
            autowidth: true,  //宽度自适应
            viewrecords: true,
            rowNum: 10,
            rowList: [10, 20, 30],
            pager: pager_prod_selector,
            altRows: true,
            //toppager: true,

            multiselect: true,
            //multikey: "ctrlKey",
            multiboxonly: true,

            loadComplete: function () {
                var table = this;
                setTimeout(function () {
                    styleCheckbox(table);

                    updateActionIcons(table);
                    updatePagerIcons(table);
                    enableTooltips(table);
                }, 0);
            },

            editurl: '${contextPath}/ktProd/getProdInfo',//nothing is saved
//            caption: "商品列表",
            jsonReader: {
                root: "recordList",
                page: "currentPage",
                total: "pageCount",
                records: "recordCount"
            },
//                onSelectAll: function(rowids,statue){
//                    //函数里做自己的处理
//					queryModel.rowIds = rowids;
//                },
//                resetSelection: function(rowid){
//
//                    return(rowid)
//				}

            //,autowidth: true,


            /**
             ,
             grouping:true,
             groupingView : {
				 groupField : ['name'],
				 groupDataSorted : true,
				 plusicon : 'fa fa-chevron-down bigger-110',
				 minusicon : 'fa fa-chevron-up bigger-110'
			},
             caption: "Grouping"
             */

        });

    }



    /**
     * 搜索商品
     */
    function searchShopProduct() {
        var supplierName = $("#supplierName").val();
        var productCode = $("#productCode").val();
//        var state = $("#state1").val();
        var productName = $("#productName").val();
        var typeId = queryModel.parentId == null ? "0" : queryModel.parentId;
        //var parentDepartmentkey = $("#id_parentDepartmentkey_name").val();

        var filters = {
            "rules": [
                {"field": "productCode", "data": productCode},
                {"field": "productName", "data": productName},
//                {"field": "supplierName", "data": supplierName},
                {"field": "typeId", "data": typeId},
                {"field": "state", "data": '1'}
            ]
        };
        console.log(JSON.stringify(filters))
        jQuery(grid_prod_selector).jqGrid('setGridParam', {
            postData: {
                "filters": JSON.stringify(filters) //"{'rules' : [{'field' : 'shopName','data' : "+shopName+"},{'field' : 'state','data' : "+state+"}]}"
            }
        }).trigger("reloadGrid");
    }
</script>